//将对象的每个属性，赋值到数组的不同对象中
export const farment = (obj = {}, array = []) => {
  // 获取对象的键值对数组
  const entries = Object.entries(obj);

  // 遍历键值对数组
  entries.forEach(([key, value]) => {
    // 检查数组中是否有对应键名的对象
    const item = array.find((i) => i.hasOwnProperty(key));
    if (item) {
      // 如果找到了，就赋值
      item[key] = value;
      item.val = value;
    }
  });

  // 返回更新后的数组
  return array;
};
export const farment2 = (list, list2) => {
  // 将 list 转换为一个映射，其中键是属性名，值是 title
  const titleMap = new Map();
  list.forEach((item) => {
    for (const key in item) {
      if (item.hasOwnProperty(key) && key !== "title") {
        titleMap.set(key, item.title);
      }
    }
  });

  // 遍历 list2，并使用 titleMap 来更新对象的属性
  list2.forEach((item) => {
    for (const key in item) {
      if (item.hasOwnProperty(key) && titleMap.has(key)) {
        item.title = titleMap.get(key);
      }
    }
  });
  return list2;
};

// 养殖放苗服务记录
export const list = [
  {
    title: "序号",
    seeding_no: "",
    val: "",
    disabled: true,
  },
  {
    title: "放苗日期",
    seeding_date: "",
    val: "",
    check: true,
  },
  {
    title: "批次",
    batch: "",
    val: "",
  },
  {
    title: "养殖户",
    farmer_title: "",
    farmer_id: "",
    val: "",
    check: true,
  },
  {
    title: "中间商",
    broker_title: "",
    broker_id: "",
    val: "",
    disabled: true,
  },
  {
    title: "地址",
    address: "",
    val: "",
    disabled: true,
  },
  {
    title: "放苗量",
    seeding_number: "",
    val: "",
  },
  {
    title: "苗源",
    seeding_source: "",
    val: "",
  },
];
// 服务---养殖服务记录表
export const list1 = [
  {
    title: "序号",
    breed_no: "",
    val: "",
    disabled: true,
  },
  {
    title: "服务日期",
    service_date: "",
    val: "",
    check: true,
    disabled: true,
  },
  {
    title: "养殖户",
    farmer_title: "",
    farmer_id: "",
    val: "",
    check: true,
    disabled: true,
  },
  {
    title: "中间商",
    broker_title: "",
    broker_id1: "",
    val: "",
    disabled: true,
  },
  {
    title: "地址",
    address: "",
    val: "",
    disabled: true,
  },
  {
    title: "批次",
    batch: "",
    val: "",
    disabled: true,
    check: false,
  },
  {
    title: "养殖量",
    breed_num: "",
    val: "",
  },
  {
    title: "日龄",
    day_age: "",
    val: "",
  },
  {
    title: "死淘数",
    dead_num: "",
    val: "",
  },
  {
    title: "余料",
    surplus_material: "",
    val: "",
  },
  {
    title: "费用",
    cost: "",
    val: "",
  },
  {
    title: "抽样只数",
    sampling_number: "",
    val: "",
  },
  {
    title: "重量(kg)",
    weight: "",
    val: "",
  },
  {
    title: "均重(kg)",
    avg_weight: "",
    val: "",
  },
  {
    title: "健康状况",
    health_status: "",
    val: "",
  },
];
//抓鸭---生产计划表
export const list2 = [
  {
    title: "序号",
    catch_duck_no: "",
    val: "",
    disabled: true,
  },
  {
    title: "计划生产日期",
    plan_date: "",
    val: "",
    disabled: true,
    check: true,
  },
  {
    title: "只数",
    num: "",
    val: "",
  },
  {
    title: "规格",
    specifications: "",
    val: "",
  },
  {
    title: "计划车次",
    planned_train_number: "",
    val: "",
  },
];
//抓鸭--抓鸭运输记录
export const list3 = [
  {
    title: "序号",
    catch_duck_transportation_no: "",
    val: "",
    disabled: true,
  },
  {
    title: "抓鸭日期",
    catch_duck_date: "",
    val: "",
    disabled: true,
    check: true,
  },
  {
    title: "养殖户",
    farmer_title: "",
    farmer_id: "",
    val: "",
    disabled: true,
    check: true,
  },
  {
    title: "地址",
    address: "",
    val: "",
  },
  {
    title: "车牌号",
    plate_number: "",
    val: "",
    disabled: true,
    check: true,
  },
  {
    title: "队长姓名",
    captain_name: "",
    val: "",
  },
  {
    title: "到达基地时间",
    arrive_base_time: "",
    val: "",
    disabled: true,
    check: true,
  },
  {
    title: "到达工厂时间",
    arrive_factory_time: "",
    val: "",
    disabled: true,
    check: true,
  },
  {
    title: "生产排序",
    production_order: "",
    val: "",
    disabled: true,
    check: true,
  },
  {
    title: "鸭规格",
    specifications: "",
    val: "",
    disabled: true,
    check: true,
  },
];

//一工段--白条
export const list4 = [
  {
    title: "生产日期",
    production_date: "",
    val: "",
  },
  {
    title: "第几车/次",
    train_number: "",
    val: "",
  },
  {
    title: "序号",
    production_section_one_no: "",
    val: "",
  },
  {
    title: "养殖户",
    farmer_title: "",
    farmer_id: "",
    val: "",
  },
  {
    title: "地点",
    address: "",
    val: "",
  },
  {
    title: "车牌号",
    plate_number: "",
    val: "",
  },
  {
    title: "驾驶员",
    driver: "",
    val: "",
  },
  {
    title: "胴体重量(kg)",
    ketone_body_weight: "",
    val: "",
  },
  {
    title: "生产只数",
    production_num: "",
    val: "",
  },
  {
    title: "残鸭只数",
    residual_duck: "",
    val: "",
  },
  {
    title: "残鸭重量(kg)",
    residual_weight: "",
    val: "",
  },
];
//一工段--抓鸭副品
export const list5 = [
  {
    title: "生产日期",
    production_date: "",
    val: "",
  },
  {
    title: "第几车/次",
    train_number: "",
    val: "",
  },
  {
    title: "序号",
    production_section_one_no: "",
    val: "",
  },
  {
    title: "养殖户",
    farmer_title: "",
    farmer_id: "",
    val: "",
  },
  {
    title: "地点",
    address: "",
    val: "",
  },
  {
    title: "车牌号",
    plate_number: "",
    val: "",
  },
  {
    title: "抓伤只数",
    scratch_num: "",
    val: "",
  },
  {
    title: "斑疮",
    macular_ulcer: "",
    val: "",
  },
  {
    title: "断翅",
    broken_wing: "",
    val: "",
  },
  {
    title: "断掌",
    palm: "",
    val: "",
  },
  {
    title: "红头",
    red_head: "",
    val: "",
  },
];
//副产车间

//四工段---产品数据统计
export const list7 = [
  {
    title: "序号",
    production_section_one_no: "",
    val: "",
  },
  {
    title: "生产日期",
    pale_date: "",
    val: "",
  },
  {
    title: "产品名称",
    product_title: "",
    val: "",
  },
  {
    title: "规格",
    sku_title: "",
    val: "",
  },
  {
    title: "数量(件)",
    num: "",
    val: "",
  },
  {
    title: "重量(kg)",
    weight: "",
    val: "",
  },
];

//四工段---白条副品统计
export const list8 = [
  {
    title: "生产日期",
    service_time: "",
    val: "",
  },
  {
    title: "日加工总数",
    total: "",
    val: "",
  },
  {
    title: "序号",
    production_section_four_white_bar_no: "",
    val: "",
  },
  {
    title: "车牌号",
    plate_number: "",
    val: "",
  },
  {
    title: "车次",
    train_number: "",
    val: "",
  },
  {
    title: "养殖户",
    farmer_title: "",
    farmer_id: "",
    val: "",
  },
  {
    title: "总只数",
    total: "",
    val: "",
  },
  {
    title: "总重量(kg)",
    weight: "",
    val: "",
  },
  {
    title: "残鸭只数",
    residual_duck_num: "",
    val: "",
  },
  {
    title: "残鸭重量(kg)",
    residual_duck_weight: "",
    val: "",
  },
  {
    title: "养殖副品",
    yz_pb_num: "",
    val: "",
  },
  {
    title: "抓伤副品",
    yz_pb_weight: "",
    val: "",
  },
  {
    title: "加工副品",
    production_order: "",
    val: "",
  },
];
// 五工段---入库成品
export const list9 = [
  {
    title: "入库日期",
    production_order: "",
    val: "",
  },
  {
    title: "编号",
    production_order: "",
    val: "",
  },
  {
    title: "序号",
    production_order: "",
    val: "",
  },
  {
    title: "产品名称",
    production_order: "",
    val: "",
  },
  {
    title: "型号",
    production_order: "",
    val: "",
  },
  {
    title: "规格",
    production_order: "",
    val: "",
  },
  {
    title: "件数",
    production_order: "",
    val: "",
  },
  {
    title: "重量(KG)",
    production_order: "",
    val: "",
  },
];

// 五工段---产成品合格
export const list10 = [
  {
    title: "抽检日期",
    production_order: "",
    val: "",
  },
  {
    title: "质检人",
    production_order: "",
    val: "",
  },
  {
    title: "序号",
    production_order: "",
    val: "",
  },
  {
    title: "生产日期",
    production_order: "",
    val: "",
  },
  {
    title: "产品名称",
    production_order: "",
    val: "",
  },
  {
    title: "型号",
    production_order: "",
    val: "",
  },
  {
    title: "规格",
    production_order: "",
    val: "",
  },
  {
    title: "个数标准范围",
    production_order: "",
    val: "",
  },
  {
    title: "重量标准范围",
    production_order: "",
    val: "",
  },
  {
    title: "抽检件数",
    production_order: "",
    val: "",
  },
  {
    title: "个数不达标件数",
    production_order: "",
    val: "",
  },
  {
    title: "重量不达标件数",
    production_order: "",
    val: "",
  },
  {
    title: "质量不达标件数",
    production_order: "",
    val: "",
  },
];
